]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
[StScrollView] Fix incorrect assertion, defaults, and test case
authorColin Walters <walters@verbum.org>
Mon, 22 Feb 2010 16:51:54 +0000 (11:51 -0500)
committerColin Walters <walters@verbum.org>
Mon, 22 Feb 2010 17:06:56 +0000 (12:06 -0500)
The type we don't currently handle is _ALWAYS, my original use
of g_return_if_fail was wrong.

Also the default should be AUTOMATIC in the properties, not ALWAYS.

Finally the test case was still using the incorrect St.ScrollPolicy.

https://bugzilla.gnome.org/show_bug.cgi?id=609015

src/st/st-scroll-view.c
tests/interactive/scrolling.js

index 1394784e691aa7ed93155961ffeccb3fc0873f91..bf463476cc9809b49b2e1b6d6b57324c6b469fda 100644 (file)
@@ -504,7 +504,7 @@ st_scroll_view_class_init (StScrollViewClass *klass)
                              "Vertical Scrollbar Policy",
                              "When the vertical scrollbar is displayed",
                              GTK_TYPE_POLICY_TYPE,
-                             GTK_POLICY_ALWAYS,
+                             GTK_POLICY_AUTOMATIC,
                              G_PARAM_READWRITE);
   g_object_class_install_property (object_class, PROP_VSCROLLBAR_POLICY, pspec);
 
@@ -512,7 +512,7 @@ st_scroll_view_class_init (StScrollViewClass *klass)
                              "Horizontal Scrollbar Policy",
                              "When the horizontal scrollbar is displayed",
                              GTK_TYPE_POLICY_TYPE,
-                             GTK_POLICY_ALWAYS,
+                             GTK_POLICY_AUTOMATIC,
                              G_PARAM_READWRITE);
   g_object_class_install_property (object_class, PROP_HSCROLLBAR_POLICY, pspec);
 
@@ -918,7 +918,7 @@ st_scroll_view_set_policy (StScrollView   *scroll,
   StAdjustment *hadjust, *vadjust;
 
   g_return_if_fail (ST_IS_SCROLL_VIEW (scroll));
-  g_return_if_fail (hscroll == GTK_POLICY_ALWAYS || vscroll == GTK_POLICY_ALWAYS);
+  g_return_if_fail (hscroll != GTK_POLICY_ALWAYS && vscroll != GTK_POLICY_ALWAYS);
 
   priv = ST_SCROLL_VIEW (scroll)->priv;
 
index 8867ed064bc9524c17d11ecd7ca35f426acf6acb..fe28b9e93ecd4982fe5ccdcfe906d6570f134fdf 100644 (file)
@@ -1,6 +1,7 @@
 /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
 
 const Clutter = imports.gi.Clutter;
+const Gtk = imports.gi.Gtk;
 const St = imports.gi.St;
 
 const UI = imports.testcommon.ui;
@@ -22,9 +23,9 @@ let v = new St.ScrollView();
 vbox.add(v, { expand: true });
 
 toggle.connect('notify::checked', function () {
-    v.set_policy(toggle.checked ? St.ScrollPolicy.AUTOMATIC
-                                : St.ScrollPolicy.NEVER,
-                 St.ScrollPolicy.AUTOMATIC);
+    v.set_policy(toggle.checked ? Gtk.PolicyType.AUTOMATIC
+                                : Gtk.PolicyType.NEVER,
+                 Gtk.PolicyType.AUTOMATIC);
 });
 
 let b = new St.BoxLayout({ vertical: true,